//
//  ZiiDetailModel.m
//  DoctorFAQs
//
//  Created by zjq on 17/3/20.
//  Copyright © 2017年 zjq. All rights reserved.
//

#import "ZiiDetailModel.h"

@implementation ZiiDetailModel
-(void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}//防止多余 key
- (instancetype)initWithDict:(NSMutableDictionary *)dict {
    self = [super init];
    if (self) {
        self.aid = dict[@"id"];
        self.xray = [NSString stringWithFormat:@"%@%@",IconURL,dict[@"xray"]];
        self.part = [NSString stringWithFormat:@"%@%@",IconURL,dict[@"part"]];
        self.report = [NSString stringWithFormat:@"%@%@",IconURL,dict[@"report"]];
        self.voice = [NSString stringWithFormat:@"%@%@",IconURL,dict[@"voice"]];
        self.d_voice = [NSString stringWithFormat:@"%@%@",IconURL,dict[@"d_voice"]];
        
        self.voice_time =  [NSString stringWithFormat:@"%@''",dict[@"voice_time"]];
        self.d_voice_time = [NSString stringWithFormat:@"%@''",dict[@"d_voice_time"]];
        NSString * str = dict[@"time"];
        NSTimeInterval time = [str doubleValue];
        NSDate *detaildate = [NSDate dateWithTimeIntervalSince1970:time];
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setDateFormat:@"YYYY-MM-dd hh:mm:ss"];
        NSString *currentDateStr = [dateFormatter stringFromDate: detaildate];
        //转化时间戳
        self.time = currentDateStr;
        
        [dict removeObjectForKey:@"id"];
        [dict removeObjectForKey:@"xray"];
        [dict removeObjectForKey:@"part"];
        [dict removeObjectForKey:@"report"];
        [dict removeObjectForKey:@"voice_time"];
        [dict removeObjectForKey:@"d_voice_time"];
        [dict removeObjectForKey:@"time"];
        [dict removeObjectForKey:@"voice"];
        [dict removeObjectForKey:@"d_voice"];
        [self setValuesForKeysWithDictionary:dict];
    }
    return self;
}
@end
